<fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?>">
    <?php if ('NONE' != $fieldset): ?>
        <h2><?php echo __($fieldset, array(), 'messages') ?></h2>
    <?php endif; ?>
    <?php $pathlabel = "";
    $pathfield = "";
    $pathattributes = array();
    $pathhelp = ""; ?>
    <?php foreach ($fields as $name => $field): ?>
        <?php
        if ($name == 'path'):
            $pathlabel = $field->getConfig('label');
            $pathfield = $field;
            $pathattributes = $field->getConfig('attributes', array());
            $pathhelp = $field->getConfig('help');
        endif;
        ?>
        <?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal()))
            continue ?>
        <?php
        include_partial('ygmPerModule/form_field', array(
            'name' => $name,
            'attributes' => $field->getConfig('attributes', array()),
            'label' => $field->getConfig('label'),
            'help' => $field->getConfig('help'),
            'form' => $form,
            'field' => $field,
            'class' => 'sf_admin_form_row sf_admin_' . strtolower($field->getType()) . ' sf_admin_form_field_' . $name,
        ))
        ?>
        <?php
        if ($name == 'description') :
            include_partial('ygmPerModule/form_path', array(
                'name' => 'path',
                'field' => $pathfield,
                'form' => $form,
                'label' => $pathlabel,
                'attributes' => $pathattributes,
                'help' => $pathhelp));
        endif;
        ?>
<?php endforeach; ?>
</fieldset>
